package core;

import java.util.HashSet;
import java.util.Set;

import com.google.common.base.Objects;
import com.google.common.collect.Sets;

/**
 * Censé remplacer l'object {@link Options}.<br>
 * Options d'un projet 3D
 * 
 * @author sebastien
 */
public class NewOptions {

	// Fields
	private Set<NewOption> options;

	// Constructor
	public NewOptions(boolean defaultLoaded) {
		options = new HashSet<NewOption>();
		if (defaultLoaded) {
			options.addAll(Sets.newHashSet(NewOption.values()));
		}
	}

	public NewOptions() {
		this(false);
	}

	// Methods
	public NewOption getOption(String name) {
		for (NewOption option : options) {
			if (option.getLabel().equals(name)) {
				return option;
			}
		}
		return null;
	}

	public void addOption(NewOption option) {
		options.add(option);
	}

	@Override
	public int hashCode() {
		return Objects.hashCode(options);
	}

	@Override
	public boolean equals(Object object) {
		if (object instanceof NewOptions) {
			NewOptions that = (NewOptions) object;
			return Objects.equal(this.options, that.options);
		}
		return false;
	}

	@Override
	public String toString() {
		return Objects.toStringHelper(this).add("options", options).toString();
	}

	// Accessors
	public Set<NewOption> getOptions() {
		return options;
	}

	public void setOptions(Set<NewOption> options) {
		this.options = options;
	}

}
